package com.itheima.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

//@Api(tags = "UserController-用户管理")
@RestController
@RequestMapping("/user")
public class UserController {
    //获取登录名
    //@RequestMapping("/getUsername")
    //public Result getUsername(){
    //    try{
    //        SecurityContext context = SecurityContextHolder.getContext();
    //        Authentication authentication = context.getAuthentication();
    //        User user = (User) authentication.getPrincipal();
    //        String username = user.getUsername();
    //        return new Result(true, MessageConstant.GET_USERNAME_SUCCESS,username);
    //    }catch (Exception e){
    //        return new Result(false, MessageConstant.GET_USERNAME_FAIL);
    //    }
    //}
    //@RequestMapping("/test")
    //public Result errorTest(){
    //    int x=0;
    //    int y=1/x;
    //    return new Result(true, "成功了");
    //}
}
